package com.tbs.parkingsaleapp.Http.Actionner;

import abstergo.tbs.betterasyc.AsycBase.IAsycResultAction;
import android.widget.Toast;
import com.tbs.parkingsaleapp.Http.JsonData.LoginResult;
import com.tbs.parkingsaleapp.SystemManager.LoadToastMananger;
import com.tbs.parkingsaleapp.SystemManager.SystemDataMananger;
import com.tbs.parkingsaleapp.UI.LoginOrSign.Base.FaceLoginFragment;

public class FaceLoginner implements IAsycResultAction<LoginResult> {
    FaceLoginFragment flf;
    public FaceLoginner(FaceLoginFragment f)
    {
        this.flf=f;
    }
    @Override
    public void ResultFunction(LoginResult result) {
        LoadToastMananger.Hide();
        switch (result.getResult())
        {
            case  -1:
                Toast.makeText(flf.getContext(), "不存在的人脸信息", Toast.LENGTH_SHORT).show();
                break;
            case 0:
                Toast.makeText(flf.getContext(), "身份证错误", Toast.LENGTH_SHORT).show();
                break;
            case 1:
                Toast.makeText(flf.getContext(), "登录成功", Toast.LENGTH_SHORT).show();
                SystemDataMananger.Login(result,flf.IsRemember(), flf.getContext());
                flf.getActivity().finish();
                break;
        }
    }
}
